package com.exercises;

import java.util.ArrayList;
import java.util.List;

public class ExerciseLCP07 {


    public int numWays(int n, int[][] relation, int k) {
        int[] dp = new int[n];
        for (int i = 0; i < k; i++) {
            int[] next = new int[n];
            for (int[] r : relation) {
                int src = r[0], dst = r[1];
                next[dst] += dp[src];
            }
            dp = next;
        }
        return dp[n - 1];
    }
}
